﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BookingSystemBLL;
using System.Data;

public partial class DeleteFlight : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            bind();
        }
    }
    protected void GridView_lookup_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string id = (this.GridView_lookup.Rows[e.RowIndex].FindControl("Label3") as Label).Text;
        if (FlightBLL.DeleteFlight(id)>0)
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('删除成功！！');</script>");
            bind();
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('删除失败！！');</script>");
        }
    }
    public void bind()
    {
        DataSet ds = FlightBLL.GetAllFlight();
        this.GridView_lookup.DataSource = ds.Tables[0];
        this.GridView_lookup.DataBind();
    }
  
    protected void Search_Click(object sender, EventArgs e)
    {

    }
}